<?php

namespace maotool\core\lang;

/**
 * HTTP 状态码常量类
 * 
 * 包含所有标准 HTTP 状态码及其描述信息，用于统一管理系统中的HTTP响应状态。
 * 
 * 字段说明:
 * - code: HTTP状态码数字值
 * - name: HTTP状态码标准英文名称
 * - message: 简体中文描述信息，便于开发人员理解状态码含义
 * 
 * 使用示例:
 * HttpStatusCode::OK['code']        // 200
 * HttpStatusCode::NOT_FOUND['name']  // "Not Found"
 * HttpStatusCode::FORBIDDEN['message'] // "禁止访问"
 */
class HttpStatusCode
{
    // 1xx 信息性状态码 (Informational)
    // 表示请求已被接受，继续处理
    const HTTP_CONTINUE = [
        "code" => 100,
        "name" => "Continue",
        "message" => "继续"
    ];

    const SWITCHING_PROTOCOLS = [
        "code" => 101,
        "name" => "Switching Protocols",
        "message" => "切换协议"
    ];

    // 2xx 成功状态码 (Success)
    // 表示请求已成功被服务器接收、理解、并接受
    const OK = [
        "code" => 200,
        "name" => "OK",
        "message" => "请求成功"
    ];

    const CREATED = [
        "code" => 201,
        "name" => "Created",
        "message" => "创建成功"
    ];

    const ACCEPTED = [
        "code" => 202,
        "name" => "Accepted",
        "message" => "已接受"
    ];

    const NON_AUTHORITATIVE_INFORMATION = [
        "code" => 203,
        "name" => "Non-Authoritative Information",
        "message" => "非授权信息"
    ];

    const NO_CONTENT = [
        "code" => 204,
        "name" => "No Content",
        "message" => "没有内容"
    ];

    const RESET_CONTENT = [
        "code" => 205,
        "name" => "Reset Content",
        "message" => "重置内容"
    ];

    const PARTIAL_CONTENT = [
        "code" => 206,
        "name" => "Partial Content",
        "message" => "部分内容"
    ];

    // 3xx 重定向状态码 (Redirection)
    // 表示需要客户端采取进一步的操作才能完成请求
    const MULTIPLE_CHOICES = [
        "code" => 300,
        "name" => "Multiple Choices",
        "message" => "多种选择"
    ];

    const MOVED_PERMANENTLY = [
        "code" => 301,
        "name" => "Moved Permanently",
        "message" => "永久移动"
    ];

    const FOUND = [
        "code" => 302,
        "name" => "Found",
        "message" => "临时移动"
    ];

    const SEE_OTHER = [
        "code" => 303,
        "name" => "See Other",
        "message" => "查看其他位置"
    ];

    const NOT_MODIFIED = [
        "code" => 304,
        "name" => "Not Modified",
        "message" => "未修改"
    ];

    const USE_PROXY = [
        "code" => 305,
        "name" => "Use Proxy",
        "message" => "使用代理"
    ];

    const TEMPORARY_REDIRECT = [
        "code" => 307,
        "name" => "Temporary Redirect",
        "message" => "临时重定向"
    ];

    const PERMANENT_REDIRECT = [
        "code" => 308,
        "name" => "Permanent Redirect",
        "message" => "永久重定向"
    ];

    // 4xx 客户端错误状态码 (Client Error)
    // 表示客户端可能出错，妨碍了服务器的处理
    const BAD_REQUEST = [
        "code" => 400,
        "name" => "Bad Request",
        "message" => "请求错误"
    ];

    const UNAUTHORIZED = [
        "code" => 401,
        "name" => "Unauthorized",
        "message" => "未授权"
    ];

    const PAYMENT_REQUIRED = [
        "code" => 402,
        "name" => "Payment Required",
        "message" => "需要付款"
    ];

    const FORBIDDEN = [
        "code" => 403,
        "name" => "Forbidden",
        "message" => "禁止访问"
    ];

    const NOT_FOUND = [
        "code" => 404,
        "name" => "Not Found",
        "message" => "服务器无法根据客户端的请求找到资源"
    ];

    const METHOD_NOT_ALLOWED = [
        "code" => 405,
        "name" => "Method Not Allowed",
        "message" => "方法不允许"
    ];

    const NOT_ACCEPTABLE = [
        "code" => 406,
        "name" => "Not Acceptable",
        "message" => "请求的资源不可用"
    ];

    const PROXY_AUTHENTICATION_REQUIRED = [
        "code" => 407,
        "name" => "Proxy Authentication Required",
        "message" => "需要代理认证"
    ];

    const REQUEST_TIMEOUT = [
        "code" => 408,
        "name" => "Request Timeout",
        "message" => "请求超时"
    ];

    const CONFLICT = [
        "code" => 409,
        "name" => "Conflict",
        "message" => "冲突"
    ];

    const GONE = [
        "code" => 410,
        "name" => "Gone",
        "message" => "已删除"
    ];

    const LENGTH_REQUIRED = [
        "code" => 411,
        "name" => "Length Required",
        "message" => "需要内容长度"
    ];

    const PRECONDITION_FAILED = [
        "code" => 412,
        "name" => "Precondition Failed",
        "message" => "前置条件失败"
    ];

    const PAYLOAD_TOO_LARGE = [
        "code" => 413,
        "name" => "Payload Too Large",
        "message" => "请求实体过大"
    ];

    const URI_TOO_LONG = [
        "code" => 414,
        "name" => "URI Too Long",
        "message" => "请求的URI过长"
    ];

    const UNSUPPORTED_MEDIA_TYPE = [
        "code" => 415,
        "name" => "Unsupported Media Type",
        "message" => "不支持的媒体类型"
    ];

    const RANGE_NOT_SATISFIABLE = [
        "code" => 416,
        "name" => "Range Not Satisfiable",
        "message" => "请求范围不符合要求"
    ];

    const EXPECTATION_FAILED = [
        "code" => 417,
        "name" => "Expectation Failed",
        "message" => "期望值错误"
    ];

    const IM_A_TEAPOT = [
        "code" => 418,
        "name" => "I'm a teapot",
        "message" => "我是一个茶壶"
    ];

    const UNPROCESSABLE_ENTITY = [
        "code" => 422,
        "name" => "Unprocessable Entity",
        "message" => "请求格式正确，但是由于含有语义错误，无法响应"
    ];

    const LOCKED = [
        "code" => 423,
        "name" => "Locked",
        "message" => "锁定"
    ];

    const FAILED_DEPENDENCY = [
        "code" => 424,
        "name" => "Failed Dependency",
        "message" => "依赖失败"
    ];

    const TOO_EARLY = [
        "code" => 425,
        "name" => "Too Early",
        "message" => "太早"
    ];

    const UPGRADE_REQUIRED = [
        "code" => 426,
        "name" => "Upgrade Required",
        "message" => "需要升级"
    ];

    const PRECONDITION_REQUIRED = [
        "code" => 428,
        "name" => "Precondition Required",
        "message" => "需要前置条件"
    ];

    const TOO_MANY_REQUESTS = [
        "code" => 429,
        "name" => "Too Many Requests",
        "message" => "请求次数过多"
    ];

    const REQUEST_HEADER_FIELDS_TOO_LARGE = [
        "code" => 431,
        "name" => "Request Header Fields Too Large",
        "message" => "请求头字段太大"
    ];

    const UNAVAILABLE_FOR_LEGAL_REASONS = [
        "code" => 451,
        "name" => "Unavailable For Legal Reasons",
        "message" => "因法律原因不可用"
    ];

    // 5xx 服务器错误状态码 (Server Error)
    // 表示服务器在处理请求的过程中有错误或者异常状态发生
    const INTERNAL_SERVER_ERROR = [
        "code" => 500,
        "name" => "Internal Server Error",
        "message" => "服务器内部错误，无法完成请求"
    ];

    const NOT_IMPLEMENTED = [
        "code" => 501,
        "name" => "Not Implemented",
        "message" => "尚未实施"
    ];

    const BAD_GATEWAY = [
        "code" => 502,
        "name" => "Bad Gateway",
        "message" => "错误网关"
    ];

    const SERVICE_UNAVAILABLE = [
        "code" => 503,
        "name" => "Service Unavailable",
        "message" => "服务器当前无法处理请求"
    ];

    const GATEWAY_TIMEOUT = [
        "code" => 504,
        "name" => "Gateway Timeout",
        "message" => "网关超时"
    ];

    const HTTP_VERSION_NOT_SUPPORTED = [
        "code" => 505,
        "name" => "HTTP Version Not Supported",
        "message" => "不支持的HTTP版本"
    ];

    const VARIANT_ALSO_NEGOTIATES = [
        "code" => 506,
        "name" => "Variant Also Negotiates",
        "message" => "变体也在协商"
    ];

    const INSUFFICIENT_STORAGE = [
        "code" => 507,
        "name" => "Insufficient Storage",
        "message" => "服务器无法完成请求"
    ];

    const LOOP_DETECTED = [
        "code" => 508,
        "name" => "Loop Detected",
        "message" => "检测到循环"
    ];

    const NOT_EXTENDED = [
        "code" => 510,
        "name" => "Not Extended",
        "message" => "未扩展"
    ];

    const NETWORK_AUTHENTICATION_REQUIRED = [
        "code" => 511,
        "name" => "Network Authentication Required",
        "message" => "需要网络认证"
    ];

    const UNKNOWN = [
        "code" => 0,
        "name" => "Unknown",
        "message" => "未知错误"
    ];

}